package com.dtz.rabbitmq.direct.service;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;

import com.dtz.rabbitmq.constant.RabbitConstant;

import lombok.extern.slf4j.Slf4j;

@Service
@Slf4j
@RabbitListener(bindings = @QueueBinding(
	value = @Queue(name = RabbitConstant.DIRECT_SMS_QUEUE, durable = "true"),
	exchange = @Exchange(name = RabbitConstant.DIRECT_ORDER_EXCHANGE, type = ExchangeTypes.DIRECT, durable = "true"),
	key = RabbitConstant.SMS_ROUTING_KEY
))
public class DirectSmsService {

	@RabbitHandler
	public void message(String message) {
		log.info("sms --------->{}", message);
	}
	
}
